-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: add separate accounts for each policy in e2e tests #2459
Conversation
WalkthroughThis change involves refactoring the Changes
Sequence Diagram(s)No sequence diagrams are necessary as the changes involve refactoring existing functionality to use different accounts, without altering the control flow or introducing new features. Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2459 +/- ##
===========================================
- Coverage 69.05% 68.99% -0.06%
===========================================
Files 308 308
Lines 19192 19209 +17
===========================================
+ Hits 13253 13254 +1
- Misses 5264 5278 +14
- Partials 675 677 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Outside diff range, codebase verification and nitpick comments (1)
e2e/txserver/zeta_tx_server.go (1)
156-157
: Add space after the period in the comment.Ensure there is a space after the period in the comment for better readability.
- // MustGetAccountAddressFromName returns the account address from the given name.It panics on error + // MustGetAccountAddressFromName returns the account address from the given name. It panics on error
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (15)
- changelog.md (1 hunks)
- cmd/zetae2e/config/localnet.yml (1 hunks)
- cmd/zetae2e/local/local.go (1 hunks)
- contrib/localnet/scripts/start-zetacored.sh (2 hunks)
- e2e/config/config.go (5 hunks)
- e2e/e2etests/test_erc20_deposit_refund.go (1 hunks)
- e2e/e2etests/test_eth_deposit_liquidity_cap.go (2 hunks)
- e2e/e2etests/test_migrate_chain_support.go (4 hunks)
- e2e/e2etests/test_pause_zrc20.go (2 hunks)
- e2e/e2etests/test_rate_limiter.go (1 hunks)
- e2e/e2etests/test_update_bytecode_connector.go (1 hunks)
- e2e/e2etests/test_update_bytecode_zrc20.go (1 hunks)
- e2e/runner/setup_zeta.go (2 hunks)
- e2e/txserver/zeta_tx_server.go (1 hunks)
- e2e/utils/zetacore.go (1 hunks)
Additional context used
Path-based instructions (13)
e2e/e2etests/test_update_bytecode_connector.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_eth_deposit_liquidity_cap.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_update_bytecode_zrc20.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_pause_zrc20.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_erc20_deposit_refund.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/utils/zetacore.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/runner/setup_zeta.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_rate_limiter.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_migrate_chain_support.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/config/config.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.cmd/zetae2e/local/local.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/txserver/zeta_tx_server.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.contrib/localnet/scripts/start-zetacored.sh (1)
Pattern
**/*.sh
: Review the shell scripts, point out issues relative to security, performance, and maintainability.
Gitleaks
cmd/zetae2e/config/localnet.yml
39-39: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
43-43: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
47-47: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
GitHub Check: codecov/patch
e2e/config/config.go
[warning] 204-208: e2e/config/config.go#L204-L208
Added lines #L204 - L208 were not covered by tests
[warning] 232-232: e2e/config/config.go#L232
Added line #L232 was not covered by tests
[warning] 236-239: e2e/config/config.go#L236-L239
Added lines #L236 - L239 were not covered by tests
[warning] 241-243: e2e/config/config.go#L241-L243
Added lines #L241 - L243 were not covered by tests
[warning] 287-287: e2e/config/config.go#L287
Added line #L287 was not covered by tests
[warning] 291-291: e2e/config/config.go#L291
Added line #L291 was not covered by tests
Additional comments not posted (22)
e2e/e2etests/test_update_bytecode_connector.go (1)
49-53
: Ensure correct usage of new policy accounts.The function
MustGetAccountAddressFromName
is used correctly to get the AdminPolicyName account address, and theBroadcastTx
function is called with the correct policy name. Ensure all instances where theFungibleAdminName
was used are updated similarly.e2e/e2etests/test_pause_zrc20.go (2)
38-41
: LGTM!The change to use the
EmergencyPolicyName
for pausing the ZRC20 token is consistent with the PR objectives.
109-112
: LGTM!The change to use the
OperationalPolicyName
for unpausing the ZRC20 token is consistent with the PR objectives.e2e/e2etests/test_erc20_deposit_refund.go (1)
39-45
: LGTM!The change to use the
OperationalPolicyName
for refunding the aborted CCTX is consistent with the PR objectives.e2e/utils/zetacore.go (1)
19-21
: LGTM!The introduction of new constants for
EmergencyPolicyName
,AdminPolicyName
, andOperationalPolicyName
is consistent with the PR objectives.e2e/runner/setup_zeta.go (2)
78-78
: LGTM!The change to use the
OperationalPolicyName
for deploying system contracts and ZRC20 tokens on ZEVM is consistent with the PR objectives.
212-219
: LGTM!The change to use the
OperationalPolicyName
for enabling header verification and funding the emissions pool is consistent with the PR objectives.e2e/e2etests/test_rate_limiter.go (1)
174-174
: LGTM!The change to use the new
OperationalPolicyName
account is correct.e2e/e2etests/test_migrate_chain_support.go (5)
62-63
: LGTM!The change to use the new
OperationalPolicyName
account is correct.
70-81
: LGTM!The change to use the new
OperationalPolicyName
account is correct.
99-100
: LGTM!The change to use the new
OperationalPolicyName
account is correct.
110-111
: LGTM!The change to use the new
OperationalPolicyName
account is correct.
159-160
: LGTM!The change to use the new
OperationalPolicyName
account is correct.e2e/config/config.go (3)
46-46
: LGTM!The addition of
PolicyAccounts
to theConfig
struct is correct.
61-68
: LGTM!The removal of
UserFungibleAdmin
fromAdditionalAccounts
is correct.
70-73
: LGTM!The addition of
PolicyAccounts
struct is correct.cmd/zetae2e/local/local.go (1)
129-134
: LGTM!The change to use the new policy account names is correct.
e2e/txserver/zeta_tx_server.go (1)
158-168
: Ensure proper usage of panic in MustGetAccountAddressFromName.Using
panic
is generally discouraged in non-test code due to its impact on program stability. However, since this function is intended for test usage only, it is acceptable here. Ensure this function is not used in production code.Ensure the function is used only in test files.
Verification successful
Ensure
MustGetAccountAddressFromName
is used only in test files.The function
MustGetAccountAddressFromName
is used in the following files:
e2e/e2etests/test_update_bytecode_connector.go
e2e/e2etests/test_migrate_chain_support.go
e2e/e2etests/test_eth_deposit_liquidity_cap.go
e2e/e2etests/test_erc20_deposit_refund.go
e2e/e2etests/test_pause_zrc20.go
e2e/e2etests/test_update_bytecode_zrc20.go
These files are located in the
e2e/e2etests/
directory, which suggests they are test files. The function appears to be used only in test files, which aligns with the intended usage.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Ensure `MustGetAccountAddressFromName` is used only in test files. # Test: Search for the function usage. Expect: Only occurances in test files. rg --type go 'MustGetAccountAddressFromName'Length of output: 1700
changelog.md (1)
79-79
: LGTM! Addition of separate accounts for each policy in E2E tests.The entry is consistent with the changelog's style and accurately describes the change.
e2e/e2etests/test_eth_deposit_liquidity_cap.go (2)
28-32
: Review: UseOperationalPolicyName
for account retrieval and broadcastingThe new account retrieval method
MustGetAccountAddressFromName(utils.OperationalPolicyName)
and the corresponding policy name are used correctly for broadcasting the transaction.
72-77
: Review: UseOperationalPolicyName
for setting liquidity capThe correct account retrieval method and policy name are used for setting the liquidity cap.
e2e/e2etests/test_update_bytecode_zrc20.go (1)
71-75
: Review: UseAdminPolicyName
for updating contract bytecodeThe new account retrieval method
MustGetAccountAddressFromName(utils.AdminPolicyName)
and the corresponding policy name are used correctly for updating the contract bytecode.
Need #2463 to be merged to fully test the functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- changelog.md (1 hunks)
- e2e/e2etests/test_rate_limiter.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- changelog.md
Additional context used
Path-based instructions (1)
e2e/e2etests/test_rate_limiter.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
Additional comments not posted (1)
e2e/e2etests/test_rate_limiter.go (1)
170-174
: UseMustGetAccountAddressFromName
for better error handling.Instead of checking for errors manually, use
MustGetAccountAddressFromName
to simplify the code and ensure it panics on error, which is appropriate for test setup code.- adminAddr, err := r.ZetaTxServer.GetAccountAddressFromName(utils.OperationalPolicyName) - if err != nil { - return err - } + adminAddr := r.ZetaTxServer.MustGetAccountAddressFromName(utils.OperationalPolicyName)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Closes #2447
How Has This Been Tested?
Summary by CodeRabbit
New Features
Refactor
FungibleAdminName
with new policy names across tests and configurations.Bug Fixes
Documentation